diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 13:39:26 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 14:02:22 +0200 |
commit | ae67261a07a528df07c4c059fab4beb333b25e49 (patch) | |
tree | bc234d2632184ca76dcdf1fe926bec784fe9c6fe | |
parent | 902ba4c49a732eb4547f08a1ead4fed019d39732 (diff) |
OpenGL API refactor.
Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of
QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of
having QPlatformGLSurface accessor in QWindow.
25 files changed, 71 insertions, 158 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h index 2960d64..2b4f9fe 100644 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h @@ -47,7 +47,7 @@ class QWaylandDisplay; class QWindow; class QPlatformGLContext; -class QGuiGLFormat; +class QSurfaceFormat; class QWaylandGLIntegration { @@ -58,7 +58,7 @@ public: virtual void initialize() = 0; virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; - virtual QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const = 0; + virtual QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const = 0; static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); }; diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp index 7fbe5cc..773087f 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp @@ -86,7 +86,7 @@ QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window return new QWaylandReadbackEglWindow(window, this); } -QPlatformGLContext *QWaylandReadbackEglWindow::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const +QPlatformGLContext *QWaylandReadbackEglWindow::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const { return new QWaylandReadbackEglContext(glFormat, share, this); } diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h index 8945cda..d96e6cf 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h @@ -63,7 +63,7 @@ public: void initialize(); QWaylandWindow *createEglWindow(QWindow *window); - QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const; + QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QWaylandDisplay *waylandDisplay() const; Display *xDisplay() const; diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp index 0ca0418..dec2cdd 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp @@ -47,16 +47,6 @@ #include <QtGui/QGuiGLContext> #include <QtCore/QDebug> -QWaylandReadbackGlxSurface::QWaylandReadbackGlxSurface(QWaylandReadbackGlxWindow *window) - : m_window(window) -{ -} - -GLXPixmap QWaylandReadbackGlxSurface::glxPixmap() const -{ - return m_window->glxPixmap(); -} - static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) { const int width = img.width(); @@ -79,7 +69,7 @@ static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) } } -QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(const QGuiGLFormat &format, +QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(const QSurfaceFormat &format, QPlatformGLContext *share, Display *display, int screen) : m_display(display) { @@ -89,17 +79,17 @@ QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(const QGuiGLFormat &forma XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); m_context = glXCreateContext(display, visualInfo, shareContext, TRUE); - m_format = qglx_guiGLFormatFromGLXFBConfig(display, config, m_context); + m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); } -QGuiGLFormat QWaylandReadbackGlxContext::format() const +QSurfaceFormat QWaylandReadbackGlxContext::format() const { return m_format; } -bool QWaylandReadbackGlxContext::makeCurrent(const QPlatformGLSurface &surface) +bool QWaylandReadbackGlxContext::makeCurrent(QPlatformSurface *surface) { - GLXPixmap glxPixmap = static_cast<const QWaylandReadbackGlxSurface &>(surface).glxPixmap(); + GLXPixmap glxPixmap = static_cast<QWaylandReadbackGlxWindow *>(surface)->glxPixmap(); return glXMakeCurrent(m_display, glxPixmap, m_context); } @@ -109,16 +99,15 @@ void QWaylandReadbackGlxContext::doneCurrent() glXMakeCurrent(m_display, 0, 0); } -void QWaylandReadbackGlxContext::swapBuffers(const QPlatformGLSurface &surface) +void QWaylandReadbackGlxContext::swapBuffers(QPlatformSurface *surface) { // #### makeCurrent() directly on the platform context doesn't update QGuiGLContext::currentContext() if (QGuiGLContext::currentContext()->handle() != this) makeCurrent(surface); - const QWaylandReadbackGlxSurface &s = - static_cast<const QWaylandReadbackGlxSurface &>(surface); + QWaylandReadbackGlxWindow *w = static_cast<QWaylandReadbackGlxWindow *>(surface); - QSize size = s.window()->geometry().size(); + QSize size = w->geometry().size(); QImage img(size, QImage::Format_ARGB32); const uchar *constBits = img.bits(); @@ -130,13 +119,13 @@ void QWaylandReadbackGlxContext::swapBuffers(const QPlatformGLSurface &surface) qgl_byteSwapImage(img, GL_UNSIGNED_INT_8_8_8_8_REV); constBits = img.bits(); - const uchar *constDstBits = s.window()->buffer(); + const uchar *constDstBits = w->buffer(); uchar *dstBits = const_cast<uchar *>(constDstBits); memcpy(dstBits, constBits, (img.width() * 4) * img.height()); - s.window()->damage(QRect(QPoint(), size)); + w->damage(QRect(QPoint(), size)); - s.window()->waitForFrameSync(); + w->waitForFrameSync(); } void (*QWaylandReadbackGlxContext::getProcAddress(const QByteArray &procName)) () diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h index 3008c29..d3a028f 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h @@ -43,7 +43,7 @@ #define QWAYLANDREADBACKGLXCONTEXT_H #include <QPlatformGLContext> -#include <QGuiGLFormat> +#include <QSurfaceFormat> #include "qwaylandreadbackglxintegration.h" @@ -52,28 +52,16 @@ class QWaylandReadbackGlxWindow; class QWaylandShmBuffer; -class QWaylandReadbackGlxSurface : public QPlatformGLSurface -{ -public: - QWaylandReadbackGlxSurface(QWaylandReadbackGlxWindow *window); - - QWaylandReadbackGlxWindow *window() const { return m_window; } - GLXPixmap glxPixmap() const; - -private: - QWaylandReadbackGlxWindow *m_window; -}; - class QWaylandReadbackGlxContext : public QPlatformGLContext { public: - QWaylandReadbackGlxContext(const QGuiGLFormat &format, QPlatformGLContext *share, Display *display, int screen); + QWaylandReadbackGlxContext(const QSurfaceFormat &format, QPlatformGLContext *share, Display *display, int screen); - QGuiGLFormat format() const; + QSurfaceFormat format() const; - void swapBuffers(const QPlatformGLSurface &surface); + void swapBuffers(QPlatformSurface *surface); - bool makeCurrent(const QPlatformGLSurface &surface); + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); void (*getProcAddress(const QByteArray &procName)) (); @@ -82,7 +70,7 @@ private: GLXContext m_context; Display *m_display; - QGuiGLFormat m_format; + QSurfaceFormat m_format; }; #endif // QWAYLANDREADBACKGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp index 6fb2a17..22ff5dc 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp @@ -71,7 +71,7 @@ QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWindow *window return new QWaylandReadbackGlxWindow(window,this); } -QPlatformGLContext *QWaylandReadbackGlxIntegration::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const +QPlatformGLContext *QWaylandReadbackGlxIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const { return new QWaylandReadbackGlxContext(glFormat, share, mDisplay, mScreen); } diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h index 0b3d0cc..05c2242 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h @@ -61,7 +61,7 @@ public: void initialize(); QWaylandWindow *createEglWindow(QWindow *window); - QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const; + QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QWaylandDisplay *waylandDisplay() const; diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp index c7f0028..41824b0 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp @@ -86,11 +86,6 @@ uchar *QWaylandReadbackGlxWindow::buffer() return m_buffer->image()->bits(); } -QPlatformGLSurface *QWaylandReadbackGlxWindow::createGLSurface() const -{ - return new QWaylandReadbackGlxSurface(const_cast<QWaylandReadbackGlxWindow *>(this)); -} - void QWaylandReadbackGlxWindow::createSurface() { QSize size(geometry().size()); diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h index 4f753c6..c92646c 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h @@ -52,8 +52,6 @@ public: QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLSurface *createGLSurface() const; - void setGeometry(const QRect &rect); Pixmap glxPixmap() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp index c43b675..6c1018d 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp @@ -48,31 +48,25 @@ #include <QtPlatformSupport/private/qeglconvenience_p.h> -QWaylandXCompositeEGLSurface::QWaylandXCompositeEGLSurface(QWaylandXCompositeEGLWindow *window) - : QEGLSurface(window->eglSurface(), window->window()->glFormat()) - , m_window(window) -{ -} - -EGLSurface QWaylandXCompositeEGLSurface::eglSurface() const -{ - return m_window->eglSurface(); -} - -QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QGuiGLFormat &format, QPlatformGLContext *share, EGLDisplay display) +QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display) : QEGLPlatformContext(format, share, display) { } -void QWaylandXCompositeEGLContext::swapBuffers(const QPlatformGLSurface &surface) +void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) { QEGLPlatformContext::swapBuffers(surface); - const QWaylandXCompositeEGLSurface &s = - static_cast<const QWaylandXCompositeEGLSurface &>(surface); + QWaylandXCompositeEGLWindow *w = + static_cast<QWaylandXCompositeEGLWindow *>(surface); + + QSize size = w->geometry().size(); - QSize size = s.window()->geometry().size(); + w->damage(QRect(QPoint(), size)); + w->waitForFrameSync(); +} - s.window()->damage(QRect(QPoint(), size)); - s.window()->waitForFrameSync(); +EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) +{ + return static_cast<QWaylandXCompositeEGLWindow *>(surface)->eglSurface(); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h index e394ea1..f0e96a1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h @@ -50,23 +50,15 @@ class QWaylandXCompositeEGLWindow; -class QWaylandXCompositeEGLSurface : public QEGLSurface -{ -public: - QWaylandXCompositeEGLSurface(QWaylandXCompositeEGLWindow *window); - - EGLSurface eglSurface() const; - QWaylandXCompositeEGLWindow *window() const { return m_window; } -private: - QWaylandXCompositeEGLWindow *m_window; -}; - class QWaylandXCompositeEGLContext : public QEGLPlatformContext { public: - QWaylandXCompositeEGLContext(const QGuiGLFormat &format, QPlatformGLContext *share, EGLDisplay display); + QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display); - void swapBuffers(const QPlatformGLSurface &surface); + void swapBuffers(QPlatformSurface *surface); + +private: + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); }; #endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp index 90d5bea..47454dc 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp @@ -75,7 +75,7 @@ QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWindow *wind return new QWaylandXCompositeEGLWindow(window,this); } -QPlatformGLContext *QWaylandXCompositeEGLIntegration::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const +QPlatformGLContext *QWaylandXCompositeEGLIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const { return new QWaylandXCompositeEGLContext(glFormat, share, eglDisplay()); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h index ac302ef..1f67bf2 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h @@ -69,7 +69,7 @@ public: void initialize(); QWaylandWindow *createEglWindow(QWindow *window); - QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const; + QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QWaylandDisplay *waylandDisplay() const; struct wl_xcomposite *waylandXComposite() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp index 5e1bab2..9bf857d 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp @@ -57,7 +57,7 @@ QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWayla , m_context(0) , m_buffer(0) , m_xWindow(0) - , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->glFormat(), true)) + , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true)) , m_surface(0) , m_waitingForSync(false) { @@ -69,11 +69,6 @@ QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLSurface *QWaylandXCompositeEGLWindow::createGLSurface() const -{ - return new QWaylandXCompositeEGLSurface(const_cast<QWaylandXCompositeEGLWindow *>(this)); -} - void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect) { QWaylandWindow::setGeometry(rect); diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h index 16188ca..535498a 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h @@ -54,8 +54,6 @@ public: QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLSurface *createGLSurface() const; - void setGeometry(const QRect &rect); EGLSurface eglSurface() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp index 54d63a2..20fb039 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp @@ -47,17 +47,7 @@ #include <QRegion> -QWaylandXCompositeGLXSurface::QWaylandXCompositeGLXSurface(QWaylandXCompositeGLXWindow *window) - : m_window(window) -{ -} - -Window QWaylandXCompositeGLXSurface::xWindow() const -{ - return m_window->xWindow(); -} - -QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QGuiGLFormat &format, QPlatformGLContext *share, Display *display, int screen) +QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformGLContext *share, Display *display, int screen) : m_display(display) { qDebug("creating XComposite-GLX context"); @@ -65,12 +55,12 @@ QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QGuiGLFormat &f GLXFBConfig config = qglx_findConfig(display, screen, format); XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); m_context = glXCreateContext(display, visualInfo, shareContext, true); - m_format = qglx_guiGLFormatFromGLXFBConfig(display, config, m_context); + m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); } -bool QWaylandXCompositeGLXContext::makeCurrent(const QPlatformGLSurface &surface) +bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface) { - Window xWindow = static_cast<const QWaylandXCompositeGLXSurface &>(surface).xWindow(); + Window xWindow = static_cast<QWaylandXCompositeGLXWindow *>(surface)->xWindow(); return glXMakeCurrent(m_display, xWindow, m_context); } @@ -80,17 +70,16 @@ void QWaylandXCompositeGLXContext::doneCurrent() glXMakeCurrent(m_display, 0, 0); } -void QWaylandXCompositeGLXContext::swapBuffers(const QPlatformGLSurface &surface) +void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) { - const QWaylandXCompositeGLXSurface &s = - static_cast<const QWaylandXCompositeGLXSurface &>(surface); + QWaylandXCompositeGLXWindow *w = static_cast<QWaylandXCompositeGLXWindow *>(surface); - QSize size = s.window()->geometry().size(); + QSize size = w->geometry().size(); - glXSwapBuffers(m_display, s.xWindow()); + glXSwapBuffers(m_display, w->xWindow()); - s.window()->damage(QRect(QPoint(), size)); - s.window()->waitForFrameSync(); + w->damage(QRect(QPoint(), size)); + w->waitForFrameSync(); } void (*QWaylandXCompositeGLXContext::getProcAddress(const QByteArray &procName)) () @@ -98,7 +87,7 @@ void (*QWaylandXCompositeGLXContext::getProcAddress(const QByteArray &procName)) return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName.constData())); } -QGuiGLFormat QWaylandXCompositeGLXContext::format() const +QSurfaceFormat QWaylandXCompositeGLXContext::format() const { return m_format; } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h index 39fe030..cabdbe1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h @@ -50,29 +50,16 @@ class QWaylandXCompositeGLXWindow; class QWaylandShmBuffer; -class QWaylandXCompositeGLXSurface : public QPlatformGLSurface -{ -public: - QWaylandXCompositeGLXSurface(QWaylandXCompositeGLXWindow *window); - - QWaylandXCompositeGLXWindow *window() const { return m_window; } - Window xWindow() const; - -private: - QWaylandXCompositeGLXWindow *m_window; -}; - - class QWaylandXCompositeGLXContext : public QPlatformGLContext { public: - QWaylandXCompositeGLXContext(const QGuiGLFormat &format, QPlatformGLContext *share, Display *display, int screen); + QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformGLContext *share, Display *display, int screen); - QGuiGLFormat format() const; + QSurfaceFormat format() const; - void swapBuffers(const QPlatformGLSurface &surface); + void swapBuffers(QPlatformSurface *surface); - bool makeCurrent(const QPlatformGLSurface &surface); + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); void (*getProcAddress(const QByteArray &procName)) (); @@ -81,7 +68,7 @@ private: GLXContext m_context; Display *m_display; - QGuiGLFormat m_format; + QSurfaceFormat m_format; }; #endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp index 426c78e..8c27fa1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp @@ -78,7 +78,7 @@ QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *wind return new QWaylandXCompositeGLXWindow(window, this); } -QPlatformGLContext *QWaylandXCompositeGLXIntegration::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const +QPlatformGLContext *QWaylandXCompositeGLXIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const { return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h index c347b11..5a779bf 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h @@ -64,7 +64,7 @@ public: void initialize(); QWaylandWindow *createEglWindow(QWindow *window); - QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const; + QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QWaylandDisplay *waylandDisplay() const; struct wl_xcomposite *waylandXComposite() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp index 797803f..abaf3b1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp @@ -54,7 +54,7 @@ QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWayla : QWaylandWindow(window) , m_glxIntegration(glxIntegration) , m_xWindow(0) - , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->glFormat())) + , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format())) , m_buffer(0) , m_waitingForSync(false) { @@ -66,11 +66,6 @@ QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLSurface *QWaylandXCompositeGLXWindow::createGLSurface() const -{ - return new QWaylandXCompositeGLXSurface(const_cast<QWaylandXCompositeGLXWindow *>(this)); -} - void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) { QWaylandWindow::setGeometry(rect); diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h index 7a19c71..acf6c8e 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h @@ -56,8 +56,6 @@ public: QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLSurface *createGLSurface() const; - void setGeometry(const QRect &rect); Window xWindow() const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9cd79e2..dc59d37 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -51,7 +51,7 @@ #include <QtGui/QWindowSystemInterface> #include <QtGui/QPlatformCursor> -#include <QtGui/QGuiGLFormat> +#include <QtGui/QSurfaceFormat> #include <QtGui/private/qpixmap_raster_p.h> @@ -100,18 +100,19 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { #ifdef QT_WAYLAND_GL_SUPPORT - if (window->surfaceType() == QWindow::OpenGLSurface) - return mDisplay->eglIntegration()->createEglWindow(window); -#endif - + return mDisplay->eglIntegration()->createEglWindow(window); +#else return new QWaylandShmWindow(window); +#endif } -QPlatformGLContext *QWaylandIntegration::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const +QPlatformGLContext *QWaylandIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const { #ifdef QT_WAYLAND_GL_SUPPORT return mDisplay->eglIntegration()->createPlatformGLContext(glFormat, share); #else + Q_UNUSED(glFormat); + Q_UNUSED(share); return 0; #endif } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 1e22191..adb8b81 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -57,7 +57,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const; + QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QList<QPlatformScreen *> screens() const; diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index bd1e61f..ba5e46c 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -63,9 +63,3 @@ QWaylandWindow::WindowType QWaylandShmWindow::windowType() const return QWaylandWindow::Shm; } -QPlatformGLSurface * QWaylandShmWindow::glSurface() const -{ - qWarning("Raster window does not have a GL drawable"); - return 0; -} - diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h index db26c5c..69d4228 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -52,7 +52,7 @@ public: ~QWaylandShmWindow(); WindowType windowType() const; - QPlatformGLSurface *glSurface() const; + QSurfaceFormat format() const { return window()->format(); } }; #endif // QWAYLANDSHMWINDOW_H |